<!------------------- 头部CSS部分 start-------------------------------------------------------------------------------->
{include file="Public/head"/}
<!------------------- 头部CSS部分 end---------------------------------------------------------------------------------->

<body class="no-skin">

<!---------------------头部消息栏,用户栏 start--------------------------------------------------------------------->
{include file="Public/header"/}
<!---------------------头部消息栏,用户栏 end----------------------------------------------------------------------->

<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <!-------------------------菜单栏 start-------------------------------------------------------------------->
    {include file="Public/menu"/}
    <!-------------------------菜单栏 end---------------------------------------------------------------------->

    <div class="main-content">
        <div class="main-content-inner">

            <!-------------------------------路径导航 面包屑 start--------------------------------------------->
            {include file="Public/breadcrumbs"/}
            <!-------------------------------路径导航 面包屑 end----------------------------------------------->

            <div class="page-content">

                <!-----------------------------右侧设置 页面提示消息 start------------------------------------->
                {include file="Public/set"/}
                <!-----------------------------右侧设置 页面提示消息 end--------------------------------------->

                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">
                            <form class="form-inline" action="" method="get">
                                <a class="btn btn-info" href="{:url('add')}">新增</a>
                                <label class="inline">用户搜索</label>
                                <select name="type" class="form-control">
                                    <option value="1">用户名</option>
                                    <option value="2">电话</option>
                                    <option value="3">邮箱</option>
                                </select>
                                <input type="text" name="keyword" class="form-control">
                                <label class="inline">&nbsp;&nbsp;排序：</label>
                                <select name="order" class="form-control">
                                    <option value="1">注册时间升</option>
                                    <option value="2">注册时间降</option>
                                </select>
                                <button type="submit" class="btn btn-purple btn-sm">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    搜索
                                </button>
                            </form>
                        </div>
                        <div class="space-4"></div>
                        <div class="row">
                            <form id="form" method="post" action="{:url('del')}">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                    <tr>
                                        <th class="center">
                                            <input class="check-all" type="checkbox" value="">
                                        </th>
                                        <th>用户名</th>
                                        <th>用户组</th>
                                        <th class="center">性别</th>
                                        <th>电话</th>
                                        <th>邮箱</th>
                                        <th class="center">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <style>
                                        .grouptd {
                                            position: relative;
                                        }

                                        .group {
                                            display: inline-block;
                                            width: 100%;
                                        }

                                        .groupselect {
                                            position: absolute;
                                            top: 0;
                                            left: 0;
                                            width: 100%;
                                            height: 100%;
                                            border: 0;
                                        }
                                    </style>
                                    {volist name="list" id="val"}
                                        <tr>
                                            <td class="center">
                                                {if condition="$val.uid neq 1"}
                                                    <input class="uids" type="checkbox" name="ids[]" value="{$val.uid}">
                                                    {else/}
                                                    <span title="系统管理员，禁止删除">--</span>
                                                {/if}
                                            </td>
                                            <td>{$val.username}</td>
                                            <td>{$val.name}</td>
                                            <td class="center"><?php if($val['sex']== 1 ){echo '男';}elseif($val['sex']==2){echo '女';}else{echo '保密';} ?></td>
                                            <td>{$val.tel}</td>
                                            <td>{$val.email}</td>
                                            <td class="center"><a href="{:url('add',array('id'=>$val.uid))}">修改</a>&nbsp;
                                                {if condition="$val.uid neq 1"}
                                                <a class="del" href="javascript:;" val="{:url('del',array('id'=>$val.uid))}" title="删除">删除</a>
                                                {/if}
                                            </td>
                                        </tr>
                                    {/volist}
                                    </tbody>
                                </table>
                            </form>
                            <div class="cf">
                                <input id="submit" class="btn btn-info" type="button" value="删除">
                            </div>
                            {$page}
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!--------------------------------底部版权 置顶 start------------------------------------------------------>
    {include file="Public/footer"/}
    <!--------------------------------底部版权 置顶 end-------------------------------------------------------->

</div>

<!--------------------------------------底部JS start----------------------------------------------------------->
{include file="Public/footerjs"/}
<!--------------------------------------底部JS end------------------------------------------------------------->

<script type="text/javascript">
    $(function () {
        $(".check-all").click(function () {
            $(".uids").prop("checked", this.checked);
        });
        $(".uids").click(function () {
            var option = $(".ids");
            option.each(function (i) {
                if (!this.checked) {
                    $(".check-all").prop("checked", false);
                    return false;
                } else {
                    $(".check-all").prop("checked", true);
                }
            });
        });
        $("#submit").click(function () {
            bootbox.confirm({
                title: "系统提示",
                message: "是否要删除所选用户？",
                callback: function (result) {
                    if (result) {
                        $("#form").submit();
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
        $(".del").click(function () {
            var url = $(this).attr('val');
            bootbox.confirm({
                title: "系统提示",
                message: "是否要删除该用户?",
                callback: function (result) {
                    if (result) {
                        window.location.href = url;
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
    })
</script>
</body>
</html>
